$(function() {
	
	$(".topnav").accordion({
		accordion:false,
		speed: 500,
		closedSign: '<img src=\'resources/images/common/close.png\' />',
		openedSign: '<img src=\'resources/images/common/open.png\' />'
	});
	
	//alert($(window).height() - ($('#header').outerHeight() + $('#footer').outerHeight()));
	//if($('.t_tmiddle').outerHeight() < ($(window).height() - ($('#header').outerHeight() + $('#footer').outerHeight())))
	//{
	//    $('.t_tmiddle').css('min-height',$(window).height() - ($('#header').outerHeight() + $('#footer').outerHeight()+30)+'px');
    	
	 //} 
	
		//$('.bg_MenuBottom').css('min-height',$('.t_tmiddle').height() - ($('.topnav').height() + 30)+'px');
		if ($.browser.msie && $.browser.version.substr(0,1)<7) 
		{
		
		$('.bg_MenuBottom').css('margin-top',$('.t_tmiddle').height() - ($('ul.topnav').height() + $('ul.topnav ul').height() +21) +'px');
		}
		else
		{
		if($("ul.topnav li").length != 2)
		{
		$('.bg_MenuBottom').css('max-height',$('.t_tmiddle').height() - ($('ul.topnav').height() + $('ul.topnav ul').height() +31) + 150 +'px');
		}
		}
		//if(($('.location_select').attr("disabled") != 'disabled') &&($.browser.msie && $.browser.version!="6.0")){
		//$('select:not(.multiple)').selectmenu({
		//		style:'dropdown', 
		//		menuWidth: 240,
		//		format: addressFormatting
		//	});
		//}
		
		
		// $(document).pngFix();
			
	});

 var addressFormatting = function(text){
 
			var newText = text;
			//array of find replaces
			var findreps = [
				{find:/^([^\-]+) \- /g, rep: '<span class="ui-selectmenu-item-header">$1</span>'},
				{find:/([^\|><]+) \| /g, rep: '<span class="ui-selectmenu-item-content">$1</span>'},
				{find:/([^\|><\(\)]+) (\()/g, rep: '<span class="ui-selectmenu-item-content">$1</span>$2'},
				{find:/([^\|><\(\)]+)$/g, rep: '<span class="ui-selectmenu-item-content">$1</span>'},
				{find:/(\([^\|><]+\))$/g, rep: '<span class="ui-selectmenu-item-footer">$1</span>'}
			];
			
			for(var i in findreps){
				newText = newText.replace(findreps[i].find, findreps[i].rep);
			}
			return newText;
		}
		

	$(document).ready(function() { 
	

//Error message	
$('.error_msg:empty').remove();
$('.error_msg:empty').css('margin-bottom','0');

		var heigh= $('.t_tmiddle-right').height();
		$('.bg_MenuBottom').css('height',heigh);

 });
